const express = require('express');
const router = express.Router();
const authController = require('../controllers/authController');

/**
 * @swagger
 * /api/auth/register:
 *   post:
 *     summary: 用户注册
 *     tags: [Auth]
 *     requestBody:
 *       required: true
 *       content:
 *         application/json:
 *           schema:
 *             type: object
 *             properties:
 *               username:
 *                 type: string
 *               password:
 *                 type: string
 *               address:
 *                 type: string
 *               contact:
 *                 type: string
 *               user_type:
 *                 type: integer
 *               role:
 *                 type: string
 *                 description: 用户角色，可选值为 user 或 admin
 *                 default: user
 *     responses:
 *       200:
 *         description: 注册成功
 *
 * /api/auth/login:
 *   post:
 *     summary: 用户登录
 *     tags: [Auth]
 *     requestBody:
 *       required: true
 *       content:
 *         application/json:
 *           schema:
 *             type: object
 *             properties:
 *               username:
 *                 type: string
 *               password:
 *                 type: string
 *     responses:
 *       200:
 *         description: 登录成功
 */
router.post('/register', authController.register);
router.post('/login', authController.login);

// 微信一键登录
router.post('/wxlogin', authController.wxlogin);
// 微信绑定分类
router.post('/wxbindcategory', authController.wxbindCategory);

module.exports = router;
